import '../api/api_services.dart';
import '../model/api_response.dart';
import '../model/user.dart';

class UserRepository{
  Future<ApiResponse<List<User>>> fetchUsers() async{
    try{
      return await ApiService.getUsers();
    }catch (e){
      return ApiResponse(data: null, status: 500, message:  "Network error: $e",);
    }
  }

  Future<ApiResponse<User>> addUser(User user) async{
    try{
      return await ApiService.createUser(user);
    }catch(e){
      return ApiResponse(data: null, status: 500, message: "Failed to create user: $e");
    }
  }
}